
<script type="text/javascript">

var formCompra = new Ext.form.FormPanel({
	//baseCls: 'x-plain',
	layout:'form',
	region:'north',
	minHeight:144,
	height:144,
	split:false,
    bodyStyle:'padding:5px',
    labelWidth: 75,
    autoScroll:true,
    labelAlign: 'top',
    border:true,
    url:'GuardarCompra',
	items:[
		{layout:'column', border:false, anchor:'100%',
            items:[
            {fieldLabel:'<b>id</b>', xtype:'hidden', id: 'id_compra', name: 'id'},
            {
                columnWidth:.15, layout: 'form', border:false,
                items: {fieldLabel:'<b>Compra</b>', xtype:'numberfield', id: 'compra_compras', name: 'compra', width:'100', maxLength:11, readOnly:true}

            },{
	            columnWidth:.15, border:false, layout: 'form',
                items:{fieldLabel:'<b>Fecha</b>', xtype:'datefield', id: 'fecha_compras', name: 'fecha', allowBlank:false, value:new Date()}
            },{
	            columnWidth:.18, border:false, layout: 'form',
	            items:{fieldLabel:'<b>Base</b>', readOnly:true, xtype:'numberfield', id: 'base_compras', name: 'base', width:'120', selectOnFocus:true, style:'text-align:right'}
            },{
	            columnWidth:.17, border:false, layout: 'form',
	            items:{fieldLabel:'<b>I.V.A.</b>', readOnly:true, xtype:'numberfield', id: 'iva_compras', name: 'iva', width:'100', selectOnFocus:true, style:'text-align:right'}
            },{
	            columnWidth:.17, border:false, layout: 'form',
	            items:{fieldLabel:'<b>Retenci&oacute;n</b>', readOnly:true, xtype:'numberfield', id: 'retencion_compras', width:'100', name: 'retencion', selectOnFocus:true, style:'text-align:right'}
            },{
	            columnWidth:.18, border:false, layout: 'form',
	            items:{fieldLabel:'<b>Total</b>', readOnly:true, xtype:'numberfield', id: 'importe_compras', name: 'importe', width:'120', selectOnFocus:true, style:'text-align:right'}
            }]
        },{layout:'column', border:false, anchor:'100%',
            items:[{
                columnWidth:.40, layout: 'form', border:false,
                items: comboProveedores
            },{
	            columnWidth:.30, border:false, layout: 'form',
                items: {fieldLabel:'<b>Factura.</b>', xtype:'textfield', id: 'factura_compras', name: 'factura',anchor:'90%', maxLength:255, selectOnFocus:true}
            },{
	            columnWidth:.30, border:false, layout: 'form',
	            items: {fieldLabel:'<b>Forma Pago</b>', xtype:'textfield', id: 'forma_pago_compras', name: 'forma_pago',anchor:'90%', maxLength:255, selectOnFocus:true}
            }]
        }],
        tbar:[{
            text:'Guardar ',
            tooltip:'Guardar cambios',
            iconCls:'save',
			listeners :{
            	click: function(){guardarCompra();}
            }
        }],
    inicializar: function() {
    	var id = Ext.getCmp('id_compra').getValue();
		//Inicializamos a su vez el grid de documentos
		gridDocumentosCompra.inicializar();
    }

});

 </script>

